export class Music {
    private bgAudio: HTMLAudioElement;
    private doorAudio:HTMLAudioElement;
    private getAudio:HTMLAudioElement;
    private glassAudio:HTMLAudioElement;
    private shootAudio:HTMLAudioElement;
    private heartAudio:HTMLAudioElement;
    private monsterAudio:HTMLAudioElement;
    private stairsAudio:HTMLAudioElement;
    private screamAudio:HTMLAudioElement;
    private hitAudio:HTMLAudioElement;


    constructor() {
        this.bgAudio=new Audio();
        this.bgAudio.volume=0.5;
        this.bgAudio.loop=true;
        this.bgAudio.src="assets/music/inference.mp3";

        this.doorAudio=new Audio();
        this.doorAudio.src="assets/music/door.mp3";

        this.glassAudio=new Audio();
        this.glassAudio.src="assets/music/glass.mp3";

        this.shootAudio=new Audio();
        this.shootAudio.src="assets/music/shoot.mp3";

        this.getAudio=new Audio();
        this.getAudio.src="assets/music/get.mp3";
        
        this.monsterAudio=new Audio();
        this.monsterAudio.src="assets/music/monster.mp3";

        this.stairsAudio=new Audio();
        this.stairsAudio.src="assets/music/stairs.mp3";

        this.screamAudio=new Audio();
        this.screamAudio.src="assets/music/scream.mp3";

        this.screamAudio=new Audio();
        this.screamAudio.src="assets/music/hit.mp3";

        this.heartAudio=new Audio();
        this.heartAudio.volume=0.6;
        this.heartAudio.src="assets/music/heart.mp3";
    }

    public bgPlay(){
        this.bgAudio.play();
    }

    public doorPlay(){
        this.doorAudio.currentTime=0;
        this.doorAudio.play();
    }

    public glassPlay(){
        this.glassAudio.currentTime=0;
        this.glassAudio.play();
    }

    public getPlay(){
        this.getAudio.currentTime=0;
        this.getAudio.play();
    }

    public screamPlay(){
        this.screamAudio.currentTime=0;
        this.screamAudio.play();
    }

    public monsterPlay(){
        this.monsterAudio.currentTime=0;
        this.monsterAudio.play();
    }

    public stairsPlay(){
        this.stairsAudio.currentTime=0;
        this.stairsAudio.play();
    }

    public hitPlay(){
        this.hitAudio.currentTime=0;
        this.hitAudio.play();
    }

    public shootPlay(){
        this.shootAudio.currentTime=0;
        this.shootAudio.play();
    }

    public heartPlay(){
        this.heartAudio.currentTime=0;
        this.heartAudio.play();
        this.heartAudio.volume+=0.2;
    }
}

export const music=new Music();
